x86/debugger: Remove debugger_trap_entry()
authorBobby Eshleman <bobby.eshleman@gmail.com>
Tue, 28 Sep 2021 20:30:25 +0000 (13:30 -0700)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 22 Apr 2022 19:39:34 +0000 (20:39 +0100)
commitaf8b805c15199831aad50bc33066494fb2cab363
tree562be25e8e1997445ab63ec3a244c2e916d88079
parentb3234f193a912ce73c838279f2cf3ff242a00dfd
x86/debugger: Remove debugger_trap_entry()

debugger_trap_entry() is unrelated to the other contents of debugger.h.  It is
a no-op for everything other than #DB/#BP, and for those it invokes guest
debugging (CONFIG_GDBSX) not host debugging (CONFIG_CRASH_DEBUG).

The reason it is a no-op for gdbstub is related to the fact that it's
description is inappropriate for any kind of useful debugging.  In normal
debugging, gdb only sees things which manifest as signals; it doesn't see
things which the kernel resolves itself (some #PF, #NM, etc).  Furthermore,
without a mechanism to invoke pv_inject_event(), the current infrastructure
will livelock on faults from guest context.

As such, there is no plausible future matching it's description.  Any work to
do something better than the current nothing will have to design something
more coherent.

Therefore, simplify everything by expanding debugger_trap_entry() into its two
non-empty locations, fixing bugs with their positioning (vs early exceptions
and curr not being safe to deference) and for #DB, deferring the pause until
the changes in %dr6 are saved to v->arch.dr6 so the debugger can actually see
which condition triggered.  This also removes some logically dead code from
do_trap(), where the compiler can't prove that #DB/#BP are handled by
different codepaths.

Signed-off-by: Bobby Eshleman <bobby.eshleman@gmail.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/include/asm/debugger.h
xen/arch/x86/traps.c